package com.uam.core.business.help;

public class GeoSubStringUtils {

    public static  String subString(String str, int start, int end) {
        return str.substring(start, end);
    }
    public static String subStringLonLat(String str,String source,String trgent) {
        return str.replaceAll(source,trgent);
    }

    public static String lonlatTemp(String str) {
        return "[["+subStringLonLat(subStringLonLat(subString(str,10,str.length()-2),", ","],[")," ",",")+"]]";
    }

    public static void main(String[] args) {
        String str = "POLYGON ((112.99564924619628 28.239649246196286, 112.99562009406256 28.239681060167644, 112.9955938256318 28.239715293853102, 112.99557064082265 28.239751686713646, 112.99555071608548 28.239789961777632, 112.99553420305958 28.23982982774871, 112.99552122741905 28.239870981222772, 112.99551188791635 28.239913108997026, 112.99550625563073 28.239955890453675, 112.9955043734273 28.239999, 112.99550625563073 28.240042109546327, 112.99551188791635 28.240084891002976, 112.99552122741905 28.24012701877723, 112.99553420305958 28.24016817225129, 112.99555071608548 28.24020803822237, 112.99557064082265 28.240246313286356, 112.9955938256318 28.2402827061469, 112.99562009406256 28.240316939832358, 112.99564924619628 28.240348753803715, 112.99568106016764 28.240377905937443, 112.9957152938531 28.240404174368194, 112.99575168671365 28.240427359177353, 112.99578996177763 28.24044728391452, 112.99582982774871 28.240463796940418, 112.99587098122277 28.240476772580948, 112.99591310899702 28.240486112083648, 112.99595589045367 28.240491744369265, 112.995999 28.240493626572707, 112.99604210954632 28.240491744369265, 112.99608489100298 28.240486112083648, 112.99612701877723 28.240476772580948, 112.99616817225129 28.240463796940418, 112.99620803822236 28.24044728391452, 112.99624631328635 28.240427359177353, 112.9962827061469 28.240404174368194, 112.99631693983235 28.240377905937443, 112.99634875380372 28.240348753803715, 113.00234875380372 28.234348753803715, 113.00237790593744 28.234316939832357, 113.0024041743682 28.2342827061469, 113.00242735917735 28.234246313286356, 113.00244728391452 28.23420803822237, 113.00246379694042 28.23416817225129, 113.00247677258095 28.23412701877723, 113.00248611208364 28.234084891002976, 113.00249174436927 28.234042109546326, 113.0024936265727 28.233999, 113.00249174436927 28.233955890453675, 113.00248611208364 28.233913108997026, 113.00247677258095 28.233870981222772, 113.00246379694042 28.23382982774871, 113.00244728391452 28.23378996177763, 113.00242735917735 28.233751686713646, 113.0024041743682 28.233715293853102, 113.00237790593744 28.233681060167644, 113.00234875380372 28.233649246196286, 113.00231693983235 28.23362009406256, 113.0022827061469 28.233593825631807, 113.00224631328635 28.23357064082265, 113.00220803822236 28.23355071608548, 113.00216817225129 28.233534203059584, 113.00212701877723 28.233521227419054, 113.00208489100298 28.233511887916354, 113.00204210954632 28.233506255630736, 113.001999 28.233504373427294, 113.00195589045367 28.233506255630736, 113.00191310899702 28.233511887916354, 113.00187098122277 28.233521227419054, 113.00182982774871 28.233534203059584, 113.00178996177763 28.23355071608548, 113.00175168671365 28.23357064082265, 113.0017152938531 28.233593825631807, 113.00168106016764 28.23362009406256, 113.00164924619628 28.233649246196286, 112.99564924619628 28.239649246196286))";
        System.out.println("[["+subStringLonLat(subStringLonLat(subString(str,10,str.length()-2),", ","],[")," ",",")+"]]");
    }
}
